﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RemoteTestRunner.Contracts;
using RemoteTestRunner.DataAccess;
using System.IO;

namespace UnitTests
{
    ///<summary>
    ///  This is a test class for ProjectDataAccessTest and is intended
    ///  to contain all ProjectDataAccessTest Unit Tests
    ///</summary>
    [TestClass]
    public class ProjectDataAccessTest
    {
        ///<summary>
        ///  Gets or sets the test context which provides
        ///  information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes

        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //

        #endregion

        ///<summary>
        ///  A test for SaveProjects
        ///</summary>
        [TestMethod]
        public void SaveProjectsTest()
        {
            string path = Path.Combine(TestContext.TestDir, @"rtr.xml");

            var target = new TestProjectAccess(path);
            var projects = new List<Project>();

            target.SaveProjects(projects);
        }

        ///<summary>
        ///  A test for GetProjects
        ///</summary>
        [TestMethod]
        public void GetProjectsTest()
        {
            var path = Path.Combine(TestContext.TestDir, @"rtr.xml");
            var target = new TestProjectAccess(path);
            //List<Project> expected = null; 
            var actual = target.GetProjects();

            path = Path.Combine(TestContext.TestDir, @"rtr2.xml");
            target = new TestProjectAccess(path);
            target.SaveProjects(actual);

            //Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}